package com.javatip.project.deep_learning.app01Slidemodel.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.javatip.project.deep_learning.app01Slidemodel.domain.App01Slidemodel;
import com.javatip.project.deep_learning.app01Slidemodel.service.IApp01SlidemodelService;
import com.javatip.framework.web.controller.BaseController;
import com.javatip.framework.web.page.TableDataInfo;
import com.javatip.framework.web.domain.AjaxResult;

/**
 * 模型训练信息操作处理
 * 
 * @author 袁伟
 * @date 2024-05-21
 */
@Controller
@RequestMapping("/deep_learning/app01Slidemodel")
public class App01SlidemodelController extends BaseController
{
    private String prefix = "deep_learning/app01Slidemodel";
	
	@Autowired
	private IApp01SlidemodelService app01SlidemodelService;
	
	@RequiresPermissions("deep_learning:app01Slidemodel:view")
	@GetMapping()
	public String app01Slidemodel()
	{
	    return prefix + "/app01Slidemodel";
	}

	/**
	 * 查询模型训练列表
	 */
	@RequiresPermissions("deep_learning:app01Slidemodel:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(App01Slidemodel app01Slidemodel)
	{
		startPage();
        List<App01Slidemodel> list = app01SlidemodelService.selectApp01SlidemodelList(app01Slidemodel);
		return getDataTable(list);
	}


	//	选取所有用户id
	@GetMapping("selectUser")
	@ResponseBody
	public List<Long> selectAllUserIds() {
		List<Long> result = app01SlidemodelService.selectAllUserIds();
//		System.out.println(result);
		return result;
	}

	/**
	 * 新增模型训练
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存模型训练
	 */
	@RequiresPermissions("deep_learning:app01Slidemodel:add")
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(App01Slidemodel app01Slidemodel)
	{		
		return toAjax(app01SlidemodelService.insertApp01Slidemodel(app01Slidemodel));
	}

	/**
	 * 修改模型训练
	 */
	@GetMapping("/edit/{id}")
	public String edit(@PathVariable("id") Integer id, ModelMap mmap)
	{
		App01Slidemodel app01Slidemodel = app01SlidemodelService.selectApp01SlidemodelById(id);
		mmap.put("app01Slidemodel", app01Slidemodel);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存模型训练
	 */
	@RequiresPermissions("deep_learning:app01Slidemodel:edit")
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(App01Slidemodel app01Slidemodel)
	{		
		return toAjax(app01SlidemodelService.updateApp01Slidemodel(app01Slidemodel));
	}
	
	/**
	 * 删除模型训练
	 */
	@RequiresPermissions("deep_learning:app01Slidemodel:remove")
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(app01SlidemodelService.deleteApp01SlidemodelByIds(ids));
	}
	
}
